<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QMimeData Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QMimeData Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QMimeData class provides a container for data that records
information about its MIME type. <a href="#details">More...</a></p>

<p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qmimedata.html#QMimeData">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qmimedata.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" />QVariant <b><a href="qmimedata.html#colorData">colorData</a></b> (<i>self</i>)</li><li><div class="fn" />QByteArray <b><a href="qmimedata.html#data">data</a></b> (<i>self</i>, QString&#160;<i>mimetype</i>)</li><li><div class="fn" />QStringList <b><a href="qmimedata.html#formats">formats</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qmimedata.html#hasColor">hasColor</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qmimedata.html#hasFormat">hasFormat</a></b> (<i>self</i>, QString&#160;<i>mimetype</i>)</li><li><div class="fn" />bool <b><a href="qmimedata.html#hasHtml">hasHtml</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qmimedata.html#hasImage">hasImage</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qmimedata.html#hasText">hasText</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qmimedata.html#hasUrls">hasUrls</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qmimedata.html#html">html</a></b> (<i>self</i>)</li><li><div class="fn" />QVariant <b><a href="qmimedata.html#imageData">imageData</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qmimedata.html#removeFormat">removeFormat</a></b> (<i>self</i>, QString&#160;<i>mimetype</i>)</li><li><div class="fn" />QVariant <b><a href="qmimedata.html#retrieveData">retrieveData</a></b> (<i>self</i>, QString&#160;<i>mimetype</i>, Type&#160;<i>preferredType</i>)</li><li><div class="fn" /><b><a href="qmimedata.html#setColorData">setColorData</a></b> (<i>self</i>, QVariant&#160;<i>color</i>)</li><li><div class="fn" /><b><a href="qmimedata.html#setData">setData</a></b> (<i>self</i>, QString&#160;<i>mimetype</i>, QByteArray&#160;<i>data</i>)</li><li><div class="fn" /><b><a href="qmimedata.html#setHtml">setHtml</a></b> (<i>self</i>, QString&#160;<i>html</i>)</li><li><div class="fn" /><b><a href="qmimedata.html#setImageData">setImageData</a></b> (<i>self</i>, QVariant&#160;<i>image</i>)</li><li><div class="fn" /><b><a href="qmimedata.html#setText">setText</a></b> (<i>self</i>, QString&#160;<i>text</i>)</li><li><div class="fn" /><b><a href="qmimedata.html#setUrls">setUrls</a></b> (<i>self</i>, list-of-QUrl&#160;<i>urls</i>)</li><li><div class="fn" />QString <b><a href="qmimedata.html#text">text</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-QUrl <b><a href="qmimedata.html#urls">urls</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QMimeData class provides a container for data that records
information about its MIME type.</p>
<p>QMimeData is used to describe information that can be stored in
the <a href="qclipboard.html">clipboard</a>, and transferred via
the <a href="dnd.html">drag and drop</a> mechanism. QMimeData
objects associate the data that they hold with the corresponding
MIME types to ensure that information can be safely transferred
between applications, and copied around within the same
application.</p>
<p>QMimeData objects are usually created using <tt>new</tt> and
supplied to <a href="qdrag.html">QDrag</a> or <a href="qclipboard.html">QClipboard</a> objects. This is to enable Qt to
manage the memory that they use.</p>
<p>A single QMimeData object can store the same data using several
different formats at the same time. The <a href="qmimedata.html#formats">formats</a>() function returns a list of
the available formats in order of preference. The <a href="qmimedata.html#data">data</a>() function returns the raw data
associated with a MIME type, and <a href="qmimedata.html#setData">setData</a>() allows you to set the data
for a MIME type.</p>
<p>For the most common MIME types, QMimeData provides convenience
functions to access the data:</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th>Tester</th>
<th>Getter</th>
<th>Setter</th>
<th>MIME Types</th>
</tr>
</thead>
<tr class="odd" valign="top">
<td><a href="qmimedata.html#hasText">hasText</a>()</td>
<td><a href="qmimedata.html#text">text</a>()</td>
<td><a href="qmimedata.html#setText">setText</a>()</td>
<td><tt>text/plain</tt></td>
</tr>
<tr class="even" valign="top">
<td><a href="qmimedata.html#hasHtml">hasHtml</a>()</td>
<td><a href="qmimedata.html#html">html</a>()</td>
<td><a href="qmimedata.html#setHtml">setHtml</a>()</td>
<td><tt>text/html</tt></td>
</tr>
<tr class="odd" valign="top">
<td><a href="qmimedata.html#hasUrls">hasUrls</a>()</td>
<td><a href="qmimedata.html#urls">urls</a>()</td>
<td><a href="qmimedata.html#setUrls">setUrls</a>()</td>
<td><tt>text/uri-list</tt></td>
</tr>
<tr class="even" valign="top">
<td><a href="qmimedata.html#hasImage">hasImage</a>()</td>
<td><a href="qmimedata.html#imageData">imageData</a>()</td>
<td><a href="qmimedata.html#setImageData">setImageData</a>()</td>
<td><tt>image/</tt> *</td>
</tr>
<tr class="odd" valign="top">
<td><a href="qmimedata.html#hasColor">hasColor</a>()</td>
<td><a href="qmimedata.html#colorData">colorData</a>()</td>
<td><a href="qmimedata.html#setColorData">setColorData</a>()</td>
<td><tt>application/x-color</tt></td>
</tr>
</table>
<p>For example, if your write a widget that accepts URL drags, you
would end up writing code like this:</p>
<pre class="cpp">
 <span class="type">void</span> MyWidget<span class="operator">.</span>dragEnterEvent(<span class="type"><a href="qdragenterevent.html">QDragEnterEvent</a></span> <span class="operator">*</span>event)
 {
     <span class="keyword">if</span> (event<span class="operator">-</span><span class="operator">&gt;</span>mimeData()<span class="operator">-</span><span class="operator">&gt;</span>hasUrls())
         event<span class="operator">-</span><span class="operator">&gt;</span>acceptProposedAction();
 }

 <span class="type">void</span> MyWidget<span class="operator">.</span>dropEvent(<span class="type"><a href="qdropevent.html">QDropEvent</a></span> <span class="operator">*</span>event)
 {
     <span class="keyword">if</span> (event<span class="operator">-</span><span class="operator">&gt;</span>mimeData()<span class="operator">-</span><span class="operator">&gt;</span>hasUrls()) {
         foreach (<span class="type"><a href="qurl.html">QUrl</a></span> url<span class="operator">,</span> event<span class="operator">-</span><span class="operator">&gt;</span>mimeData()<span class="operator">-</span><span class="operator">&gt;</span>urls()) {
             <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
         }
     }
 }
</pre>
<p>There are three approaches for storing custom data in a
QMimeData object:</p>
<ol class="1">
<li>Custom data can be stored directly in a QMimeData object as a
<a href="qbytearray.html">QByteArray</a> using <a href="qmimedata.html#setData">setData</a>(). For example:
<pre class="cpp">
 <span class="type"><a href="qbytearray.html">QByteArray</a></span> csvData <span class="operator">=</span> <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>;

 <span class="type">QMimeData</span> <span class="operator">*</span>mimeData <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QMimeData</span>;
 mimeData<span class="operator">-</span><span class="operator">&gt;</span><a href="qmimedata.html#setData">setData</a>(<span class="string">"text/csv"</span><span class="operator">,</span> csvData);
</pre></li>
<li>We can subclass QMimeData and reimplement <a href="qmimedata.html#hasFormat">hasFormat</a>(), <a href="qmimedata.html#formats">formats</a>(), and <a href="qmimedata.html#retrieveData">retrieveData</a>().</li>
<li>If the drag and drop operation occurs within a single
application, we can subclass QMimeData and add extra data in it,
and use a <a href="qobject.html#qobject_cast">qobject_cast</a>() in
the receiver's drop event handler. For example:
<pre class="cpp">
 <span class="type">void</span> MyWidget<span class="operator">.</span>dropEvent(<span class="type"><a href="qdropevent.html">QDropEvent</a></span> <span class="operator">*</span>event)
 {
     <span class="keyword">const</span> MyMimeData <span class="operator">*</span>myData <span class="operator">=</span>
             qobject_cast<span class="operator">&lt;</span><span class="keyword">const</span> MyMimeData <span class="operator">*</span><span class="operator">&gt;</span>(event<span class="operator">-</span><span class="operator">&gt;</span>mimeData());
     <span class="keyword">if</span> (myData) {
         <span class="comment">// access myData's data directly (not through QMimeData's API)</span>
     }
 }
</pre></li>
</ol>
<a id="platform-specific-mime-types" name="platform-specific-mime-types" />
<h3>Platform-Specific MIME Types</h3>
<p>On Windows, <a href="qmimedata.html#formats">formats</a>() will
also return custom formats available in the MIME data, using the
<tt>x-qt-windows-mime</tt> subtype to indicate that they represent
data in non-standard formats. The formats will take the following
form:</p>
<pre class="cpp">
 application<span class="operator">/</span>x<span class="operator">-</span>qt<span class="operator">-</span>windows<span class="operator">-</span>mime;value<span class="operator">=</span><span class="string">"&lt;custom type&gt;"</span>
</pre>
<p>The following are examples of custom MIME types:</p>
<pre class="cpp">
 application<span class="operator">/</span>x<span class="operator">-</span>qt<span class="operator">-</span>windows<span class="operator">-</span>mime;value<span class="operator">=</span><span class="string">"FileGroupDescriptor"</span>
 application<span class="operator">/</span>x<span class="operator">-</span>qt<span class="operator">-</span>windows<span class="operator">-</span>mime;value<span class="operator">=</span><span class="string">"FileContents"</span>
</pre>
<p>The <tt>value</tt> declaration of each format describes the way
in which the data is encoded.</p>
<p>On Windows, the MIME format does not always map directly to the
clipboard formats. Qt provides <a href="qwindowsmime.html">QWindowsMime</a> to map clipboard formats to
open-standard MIME formats. Similarly, the <a href="qmacpasteboardmime.html">QMacPasteboardMime</a> maps MIME to Mac
flavors.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QMimeData" />QMimeData.__init__ (<i>self</i>)</h3><p>Constructs a new MIME data object with no data in it.</p>


<h3 class="fn"><a name="clear" />QMimeData.clear (<i>self</i>)</h3><p>Removes all the MIME type and data entries in the object.</p>


<h3 class="fn"><a name="colorData" />QVariant QMimeData.colorData (<i>self</i>)</h3><p>Returns a color if the data stored in the object represents a
color (MIME type <tt>application/x-color</tt>); otherwise returns a
null variant.</p>
<p>A <a href="qvariant.html">QVariant</a> is used because <a href="qmimedata.html">QMimeData</a> belongs to the <a href="qtcore.html">QtCore</a> library, whereas <a href="qcolor.html">QColor</a> belongs to <a href="qtgui.html">QtGui</a>.
To convert the <a href="qvariant.html">QVariant</a> to a <a href="qcolor.html">QColor</a>, simply use <a href="qvariant.html#qvariant_cast">qvariant_cast</a>(). For example:</p>
<pre class="cpp">
 <span class="keyword">if</span> (event<span class="operator">-</span><span class="operator">&gt;</span>mimeData()<span class="operator">-</span><span class="operator">&gt;</span>hasColor()) {
     <span class="type"><a href="qcolor.html">QColor</a></span> color <span class="operator">=</span> qvariant_cast<span class="operator">&lt;</span><span class="type"><a href="qcolor.html">QColor</a></span><span class="operator">&gt;</span>(event<span class="operator">-</span><span class="operator">&gt;</span>mimeData()<span class="operator">-</span><span class="operator">&gt;</span>colorData());
     <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 }
</pre>
<p><b>See also</b> <a href="qmimedata.html#hasColor">hasColor</a>(), <a href="qmimedata.html#setColorData">setColorData</a>(), and <a href="qmimedata.html#data">data</a>().</p>


<h3 class="fn"><a name="data" /><a href="qbytearray.html">QByteArray</a> QMimeData.data (<i>self</i>, QString&#160;<i>mimetype</i>)</h3><p>Returns the data stored in the object in the format described by
the MIME type specified by <i>mimeType</i>.</p>
<p><b>See also</b> <a href="qmimedata.html#setData">setData</a>().</p>


<h3 class="fn"><a name="formats" />QStringList QMimeData.formats (<i>self</i>)</h3><p>Returns a list of formats supported by the object. This is a
list of MIME types for which the object can return suitable data.
The formats in the list are in a priority order.</p>
<p>For the most common types of data, you can call the higher-level
functions <a href="qmimedata.html#hasText">hasText</a>(), <a href="qmimedata.html#hasHtml">hasHtml</a>(), <a href="qmimedata.html#hasUrls">hasUrls</a>(), <a href="qmimedata.html#hasImage">hasImage</a>(), and <a href="qmimedata.html#hasColor">hasColor</a>() instead.</p>
<p><b>See also</b> <a href="qmimedata.html#hasFormat">hasFormat</a>(), <a href="qmimedata.html#setData">setData</a>(), and <a href="qmimedata.html#data">data</a>().</p>


<h3 class="fn"><a name="hasColor" />bool QMimeData.hasColor (<i>self</i>)</h3><p>Returns true if the object can return a color (MIME type
<tt>application/x-color</tt>); otherwise returns false.</p>
<p><b>See also</b> <a href="qmimedata.html#setColorData">setColorData</a>(), <a href="qmimedata.html#colorData">colorData</a>(), and <a href="qmimedata.html#hasFormat">hasFormat</a>().</p>


<h3 class="fn"><a name="hasFormat" />bool QMimeData.hasFormat (<i>self</i>, QString&#160;<i>mimetype</i>)</h3><p>Returns true if the object can return data for the MIME type
specified by <i>mimeType</i>; otherwise returns false.</p>
<p>For the most common types of data, you can call the higher-level
functions <a href="qmimedata.html#hasText">hasText</a>(), <a href="qmimedata.html#hasHtml">hasHtml</a>(), <a href="qmimedata.html#hasUrls">hasUrls</a>(), <a href="qmimedata.html#hasImage">hasImage</a>(), and <a href="qmimedata.html#hasColor">hasColor</a>() instead.</p>
<p><b>See also</b> <a href="qmimedata.html#formats">formats</a>(),
<a href="qmimedata.html#setData">setData</a>(), and <a href="qmimedata.html#data">data</a>().</p>


<h3 class="fn"><a name="hasHtml" />bool QMimeData.hasHtml (<i>self</i>)</h3><p>Returns true if the object can return HTML (MIME type
<tt>text/html</tt>); otherwise returns false.</p>
<p><b>See also</b> <a href="qmimedata.html#setHtml">setHtml</a>(),
<a href="qmimedata.html#html">html</a>(), and <a href="qmimedata.html#hasFormat">hasFormat</a>().</p>


<h3 class="fn"><a name="hasImage" />bool QMimeData.hasImage (<i>self</i>)</h3><p>Returns true if the object can return an image; otherwise
returns false.</p>
<p><b>See also</b> <a href="qmimedata.html#setImageData">setImageData</a>(), <a href="qmimedata.html#imageData">imageData</a>(), and <a href="qmimedata.html#hasFormat">hasFormat</a>().</p>


<h3 class="fn"><a name="hasText" />bool QMimeData.hasText (<i>self</i>)</h3><p>Returns true if the object can return plain text (MIME type
<tt>text/plain</tt>); otherwise returns false.</p>
<p><b>See also</b> <a href="qmimedata.html#setText">setText</a>(),
<a href="qmimedata.html#text">text</a>(), <a href="qmimedata.html#hasHtml">hasHtml</a>(), and <a href="qmimedata.html#hasFormat">hasFormat</a>().</p>


<h3 class="fn"><a name="hasUrls" />bool QMimeData.hasUrls (<i>self</i>)</h3><p>Returns true if the object can return a list of urls; otherwise
returns false.</p>
<p>URLs correspond to the MIME type <tt>text/uri-list</tt>.</p>
<p><b>See also</b> <a href="qmimedata.html#setUrls">setUrls</a>(),
<a href="qmimedata.html#urls">urls</a>(), and <a href="qmimedata.html#hasFormat">hasFormat</a>().</p>


<h3 class="fn"><a name="html" />QString QMimeData.html (<i>self</i>)</h3><p>Returns a string if the data stored in the object is HTML (MIME
type <tt>text/html</tt>); otherwise returns an empty string.</p>
<p><b>See also</b> <a href="qmimedata.html#setHtml">setHtml</a>(),
<a href="qmimedata.html#hasHtml">hasHtml</a>(), and <a href="qmimedata.html#setData">setData</a>().</p>


<h3 class="fn"><a name="imageData" />QVariant QMimeData.imageData (<i>self</i>)</h3><p>Returns a <a href="qvariant.html">QVariant</a> storing a
<a href="qimage.html">QImage</a> if the object can return an image;
otherwise returns a null variant.</p>
<p>A <a href="qvariant.html">QVariant</a> is used because <a href="qmimedata.html">QMimeData</a> belongs to the <a href="qtcore.html">QtCore</a> library, whereas <a href="qimage.html">QImage</a> belongs to <a href="qtgui.html">QtGui</a>.
To convert the <a href="qvariant.html">QVariant</a> to a <a href="qimage.html">QImage</a>, simply use <a href="qvariant.html#qvariant_cast">qvariant_cast</a>(). For example:</p>
<pre class="cpp">
 <span class="keyword">if</span> (event<span class="operator">-</span><span class="operator">&gt;</span>mimeData()<span class="operator">-</span><span class="operator">&gt;</span>hasImage()) {
     <span class="type"><a href="qimage.html">QImage</a></span> image <span class="operator">=</span> qvariant_cast<span class="operator">&lt;</span><span class="type"><a href="qimage.html">QImage</a></span><span class="operator">&gt;</span>(event<span class="operator">-</span><span class="operator">&gt;</span>mimeData()<span class="operator">-</span><span class="operator">&gt;</span>imageData());
     <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 }
</pre>
<p><b>See also</b> <a href="qmimedata.html#setImageData">setImageData</a>() and <a href="qmimedata.html#hasImage">hasImage</a>().</p>


<h3 class="fn"><a name="removeFormat" />QMimeData.removeFormat (<i>self</i>, QString&#160;<i>mimetype</i>)</h3><p>Removes the data entry for <i>mimeType</i> in the object.</p>
<p>This function was introduced in Qt 4.4.</p>


<h3 class="fn"><a name="retrieveData" />QVariant QMimeData.retrieveData (<i>self</i>, QString&#160;<i>mimetype</i>, <a href="qtcore.html#Type-enum">Type</a>&#160;<i>preferredType</i>)</h3><p>Returns a variant with the given <i>type</i> containing data for
the MIME type specified by <i>mimeType</i>. If the object does not
support the MIME type or variant type given, a null variant is
returned instead.</p>
<p>This function is called by the general <a href="qmimedata.html#data">data</a>() getter and by the convenience
getters (<a href="qmimedata.html#text">text</a>(), <a href="qmimedata.html#html">html</a>(), <a href="qmimedata.html#urls">urls</a>(), <a href="qmimedata.html#imageData">imageData</a>(), and <a href="qmimedata.html#colorData">colorData</a>()). You can reimplement it
if you want to store your data using a custom data structure
(instead of a <a href="qbytearray.html">QByteArray</a>, which is
what <a href="qmimedata.html#setData">setData</a>() provides). You
would then also need to reimplement <a href="qmimedata.html#hasFormat">hasFormat</a>() and <a href="qmimedata.html#formats">formats</a>().</p>
<p><b>See also</b> <a href="qmimedata.html#data">data</a>().</p>


<h3 class="fn"><a name="setColorData" />QMimeData.setColorData (<i>self</i>, QVariant&#160;<i>color</i>)</h3><p>Sets the color data in the object to the given <i>color</i>.</p>
<p>Colors correspond to the MIME type
<tt>application/x-color</tt>.</p>
<p><b>See also</b> <a href="qmimedata.html#colorData">colorData</a>(), <a href="qmimedata.html#hasColor">hasColor</a>(), and <a href="qmimedata.html#setData">setData</a>().</p>


<h3 class="fn"><a name="setData" />QMimeData.setData (<i>self</i>, QString&#160;<i>mimetype</i>, <a href="qbytearray.html">QByteArray</a>&#160;<i>data</i>)</h3><p>Sets the data associated with the MIME type given by
<i>mimeType</i> to the specified <i>data</i>.</p>
<p>For the most common types of data, you can call the higher-level
functions <a href="qmimedata.html#setText">setText</a>(), <a href="qmimedata.html#setHtml">setHtml</a>(), <a href="qmimedata.html#setUrls">setUrls</a>(), <a href="qmimedata.html#setImageData">setImageData</a>(), and <a href="qmimedata.html#setColorData">setColorData</a>() instead.</p>
<p>Note that if you want to use a custom data type in an item view
drag and drop operation, you must register it as a Qt <a href="qmetatype.html">meta type</a>, using the <a href="qmetatype.html#Q_DECLARE_METATYPE">Q_DECLARE_METATYPE</a>() macro,
and implement stream operators for it. The stream operators must
then be registered with the <a href="qmetatype.html#qRegisterMetaTypeStreamOperators">qRegisterMetaTypeStreamOperators</a>()
function.</p>
<p><b>See also</b> <a href="qmimedata.html#data">data</a>(),
<a href="qmimedata.html#hasFormat">hasFormat</a>(), <a href="qmetatype.html">QMetaType</a>, and <a href="qmetatype.html#qRegisterMetaTypeStreamOperators">qRegisterMetaTypeStreamOperators</a>().</p>


<h3 class="fn"><a name="setHtml" />QMimeData.setHtml (<i>self</i>, QString&#160;<i>html</i>)</h3><p>Sets <i>html</i> as the HTML (MIME type <tt>text/html</tt>) used
to represent the data.</p>
<p><b>See also</b> <a href="qmimedata.html#html">html</a>(),
<a href="qmimedata.html#hasHtml">hasHtml</a>(), <a href="qmimedata.html#setText">setText</a>(), and <a href="qmimedata.html#setData">setData</a>().</p>


<h3 class="fn"><a name="setImageData" />QMimeData.setImageData (<i>self</i>, QVariant&#160;<i>image</i>)</h3><p>Sets the data in the object to the given <i>image</i>.</p>
<p>A <a href="qvariant.html">QVariant</a> is used because <a href="qmimedata.html">QMimeData</a> belongs to the <a href="qtcore.html">QtCore</a> library, whereas <a href="qimage.html">QImage</a> belongs to <a href="qtgui.html">QtGui</a>.
The conversion from <a href="qimage.html">QImage</a> to <a href="qvariant.html">QVariant</a> is implicit. For example:</p>
<pre class="cpp">
 mimeData<span class="operator">-</span><span class="operator">&gt;</span>setImageData(<span class="type"><a href="qimage.html">QImage</a></span>(<span class="string">"beautifulfjord.png"</span>));
</pre>
<p><b>See also</b> <a href="qmimedata.html#imageData">imageData</a>(), <a href="qmimedata.html#hasImage">hasImage</a>(), and <a href="qmimedata.html#setData">setData</a>().</p>


<h3 class="fn"><a name="setText" />QMimeData.setText (<i>self</i>, QString&#160;<i>text</i>)</h3><p>Sets <i>text</i> as the plain text (MIME type
<tt>text/plain</tt>) used to represent the data.</p>
<p><b>See also</b> <a href="qmimedata.html#text">text</a>(),
<a href="qmimedata.html#hasText">hasText</a>(), <a href="qmimedata.html#setHtml">setHtml</a>(), and <a href="qmimedata.html#setData">setData</a>().</p>


<h3 class="fn"><a name="setUrls" />QMimeData.setUrls (<i>self</i>, list-of-QUrl&#160;<i>urls</i>)</h3><p>Sets the URLs stored in the MIME data object to those specified
by <i>urls</i>.</p>
<p>URLs correspond to the MIME type <tt>text/uri-list</tt>.</p>
<p><b>See also</b> <a href="qmimedata.html#urls">urls</a>(),
<a href="qmimedata.html#hasUrls">hasUrls</a>(), and <a href="qmimedata.html#setData">setData</a>().</p>


<h3 class="fn"><a name="text" />QString QMimeData.text (<i>self</i>)</h3><p>Returns a plain text (MIME type <tt>text/plain</tt>)
representation of the data.</p>
<p><b>See also</b> <a href="qmimedata.html#setText">setText</a>(),
<a href="qmimedata.html#hasText">hasText</a>(), <a href="qmimedata.html#html">html</a>(), and <a href="qmimedata.html#data">data</a>().</p>


<h3 class="fn"><a name="urls" />list-of-QUrl QMimeData.urls (<i>self</i>)</h3><p>Returns a list of URLs contained within the MIME data
object.</p>
<p>URLs correspond to the MIME type <tt>text/uri-list</tt>.</p>
<p><b>See also</b> <a href="qmimedata.html#setUrls">setUrls</a>(),
<a href="qmimedata.html#hasUrls">hasUrls</a>(), and <a href="qmimedata.html#data">data</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>